/*
 * @Author: Leo.wang wanglizhigs@163.com
 * @Date: 2024-05-06 08:47:12
 * @LastEditors: Leo.wang wanglizhigs@163.com
 * @LastEditTime: 2024-05-12 19:49:17
 * @FilePath: /gptfront-dev/src/main.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { createSSRApp } from 'vue'
import { createI18n } from 'vue-i18n'
import App from './App.vue'
import store from './store'
import { languages } from './i18n'
import '@/styles/index.scss'


import { createPinia } from 'pinia'
import piniaPluginPersist from 'pinia-plugin-persist';
const pinia = createPinia();
pinia.use(piniaPluginPersist);


const messages = Object.assign(languages)

export function createApp() {
    const app = createSSRApp(App)
    const locale = uni.getStorageSync('locale') || 'zh-CN'
    const i18n = createI18n({
        legacy: false,
        locale,
        fallbackLocale: 'en',
        messages,
    })
    app.use(store)
    app.use(pinia)
    app.use(i18n)

    return { app }
}
